package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.跨部门方案Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by lusong on 2016/11/28.
 */
public interface 跨部门方案Repository extends JpaRepository<跨部门方案Model, Integer>, JpaSpecificationExecutor<跨部门方案Model> {

    @Query("select a from 跨部门方案Model a where a.许可 =?1 and a.年月 =?2 and a.车型 =?3 and a.项目 <> '' and a.项目 is not null")
    List<跨部门方案Model> findRelevantDepartment(String permit, String yearMonth, String carCode);


    @Query("select a from 跨部门方案Model a where a.许可 =?1 and a.年月 =?2 and a.车型 =?3 and (a.项目 = '' or a.项目 is null)")
    List<跨部门方案Model> findActionPlan(String permit, String yearMonth, String carCode);
}
